package com.github.scheduler;

import com.github.service.CallLogServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class CallRecordScheduler {
    // 在控制器或服务中添加测试
    private final Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    private CallLogServer callLogServer;

    @Scheduled(cron = "0 0 0 * * ? ", zone = "Asia/Shanghai")
    public void clearAllCallRecords() {
        callLogServer.delCallLog();
        logger.info("所有通话记录已自动清空！");
    }
}
